-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Usernames should encode all characters in emails #9541
base: alpha
Are you sure you want to change the base?
Conversation
I will reformat the title to use the proper commit message syntax. |
Thanks for opening this pull request! |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## alpha #9541 +/- ##
==========================================
- Coverage 93.51% 93.49% -0.03%
==========================================
Files 186 186
Lines 14807 14810 +3
==========================================
- Hits 13847 13846 -1
- Misses 960 964 +4 ☔ View full report in Codecov by Sentry. |
* @returns {String} The encoded string. | ||
*/ | ||
static encode(input) { | ||
return encodeURIComponent(input).replace(/[!'()*]/g, char => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From here:
But GMail/GitHub/Facebook (etc) require escaping because people often put a closing parenthesis or square bracket or comma or period (etc) right after a URL in a sentence. In almost all cases, the URL didn't end with that punctuation, the punctuation was added by the user after pasting the URL. So the problem is that encodeURIComponent strictly follows the standard instead of dealing with certain non-conforming aspects of reality (that have good reasons to be non-conforming, imho).
How does it handle dot, comma, etc after the URL? Do we need to add these chars to the regex, or add tests for that?
emailAdapter: emailAdapter, | ||
}); | ||
|
||
user.setUsername('hello :)'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a loop and test a bunch of different chars? See also #9541 (comment).
@mathieulb does this address the issue you described? |
Pull Request
Issue
Closes: #9111
Approach
Tasks